package com.lhoverc.controller.admin;

import com.lhoverc.annotation.Log;
import com.lhoverc.pojo.Result;
import com.lhoverc.pojo.VO.ActivityVO;
import com.lhoverc.pojo.entity.ActivityEntity;
import com.lhoverc.service.activity.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author: LiCheng
 * @CreateTime: 2025-04-20
 * @Description:
 * @Version: 1.0
 */
@RestController
@RequestMapping("/admin/activity")
public class AdminActivityController {

    @Autowired
    private ActivityService activityService;

    /**
     * 获取所有的活动信息
     *
     * @return
     */
//    @GetMapping("/getAllActivity")
//    public Result getAllActivity(@RequestParam String activityName,
//                                 @RequestParam Integer status,
//                                 @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") LocalDate registrationDate,
//                                 @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") LocalDate activityDate) {
//        List<ActivityVO> activityVOList = activityService.getActivityList(activityName, status, registrationDate,activityDate);
//        return Result.success(activityVOList);
//    }

    /**
     * 发布活动
     *
     * @param activityEntity
     * @return
     */
    @Log
    @PostMapping("/addActivity")
    public Result addActivity(@RequestBody ActivityEntity activityEntity) {
        activityService.addActivity(activityEntity);
        return Result.success();
    }

    /**
     * 删除活动
     * @param id
     * @return
     */
    @Log
    @GetMapping("/deleteActivity/{id}")
    public Result deleteActivity(@PathVariable String id) {
        activityService.deleteActivity(id);
        return Result.success();
    }

    /**
     * 修改活动信息
     * @param activityEntity
     * @return
     */
    @Log
    @PostMapping("/updateActivity")
    public Result updateActivity(@RequestBody ActivityEntity activityEntity) {
        activityService.updateActivity(activityEntity);
        return Result.success();
    }
}
